package com.lianyun.day01;

public class ForDemo {

    public static void main(String[] args) {

        //用for循环完成1-10的累加

       /* int x = 1;
        int sum = 0;
        while (x<11){

            sum = sum + x;
            x++;

        }
        System.out.println("sum="+sum);

        */

        /*int sum = 0;
        for (int x=1; x<=10; x++){

            sum = sum +x;
        }
        System.out.println("sum="+sum);

         */


        /*for (int x=0; x<3; x++){

            for (int y=0; y<4; y++){
                System.out.println("y="+y);
            }
            System.out.println("x="+x);
        }

         */

        /*for (int x=0; x<4; x++){

            for (int y=0; y<5; y++){
                System.out.print("*");
            }
            System.out.println();
        }

         */


        /*for (int x=1; x<=5; x++){

            for (int y=5; y>=1; y--){
                System.out.print(y);
            }
            System.out.println();
        }
         */

       /* for (int x=1; x<=9; x++){

            for (int y=1; y<=x; y++){
                System.out.print(y+"*"+x+"="+y*x+"\t ");
            }
            System.out.println();
        }
        */

        for (int x = 1; x <= 5; x++) {
            for (int y = 1; y < x; y++) {

                System.out.print(" ");
            }

            for (int z = x; z <= 5; z++) {

                System.out.print("* ");
            }

            System.out.println();
        }
    }


}
